﻿using IEntities;
using System.Linq;

namespace Entities
{
    public abstract class Entity : IEntity
    {
        public abstract object[] GetKeys();

        public override string ToString() => $"[Entity: {GetType().Name}] Keys = {GetKeys().ToArray()}";
    }

    public abstract class Entity<TKey> : Entity, IEntity<TKey>
    {
        public TKey ID { get; protected set; }

        public Entity()
        {

        }
        public Entity(TKey id)
        {
            ID = id;
        }

        public override object[] GetKeys()
        {
            return new object[] { ID };
        }

        public override string ToString()
        {
            return $"[Entity: {GetType().Name}] ID = {ID}";
        }
    }
}
